package com.heaven.back.utils.Inits;


import com.heaven.back.pojo.Game;
import com.heaven.back.pojo.Room;

import java.util.HashMap;

/**
 * The type Map init.
 */
public class MapInit {
    /**
     * 创建所有房间对象并连接其出口用以构建迷宫.
     *
     * @param game the game
     */
    public void mapInit(Game game) {
        HashMap<String, Room> game_map = game.getGameMap();

        // 初始化房间
        game_map.put("森林中心", new Room("森林中心"));
        game_map.put("森林东部", new Room("森林东部"));
        game_map.put("森林北部", new Room("森林北部"));
        game_map.put("沙漠北部", new Room("沙漠北部"));
        game_map.put("沙漠神殿入口", new Room("沙漠神殿入口"));
        game_map.put("沙漠神殿内部", new Room("沙漠神殿内部"));
        game_map.put("森林池塘", new Room("森林池塘"));
        game_map.put("小沼泽", new Room("小沼泽"));
        game_map.put("村庄入口", new Room("村庄入口"));

        // 初始化房间出口与相关特性
        game_map.get("森林中心").setExit("east", game_map.get("森林东部"));
        game_map.get("森林中心").setExit("west", game_map.get("森林池塘"));
        game_map.get("森林中心").setExit("south", game_map.get("沙漠北部"));
        game_map.get("森林中心").setExit("north", game_map.get("森林北部"));

        game_map.get("森林东部").setExit("west", game_map.get("森林中心"));
        game_map.get("森林东部").setExit("north", game_map.get("村庄入口"));

        game_map.get("森林北部").setExit("south", game_map.get("森林中心"));
        game_map.get("森林北部").setExit("east", game_map.get("村庄入口"));
        game_map.get("森林北部").setExit("west", game_map.get("小沼泽"));

        game_map.get("沙漠北部").setExit("north", game_map.get("森林中心"));
        game_map.get("沙漠北部").setExit("east", game_map.get("沙漠神殿入口"));

        game_map.get("沙漠神殿入口").setExit("west", game_map.get("沙漠北部"));
        game_map.get("沙漠神殿入口").setExit("east", game_map.get("沙漠神殿内部"));

        game_map.get("沙漠神殿内部").setTeleport(true);

        game_map.get("村庄入口").setExit("west", game_map.get("森林北部"));
        game_map.get("村庄入口").setExit("south", game_map.get("森林东部"));

        game_map.get("森林池塘").setExit("east", game_map.get("森林中心"));
        game_map.get("森林池塘").setExit("north", game_map.get("小沼泽"));

        game_map.get("小沼泽").setExit("south", game_map.get("森林池塘"));
        game_map.get("小沼泽").setExit("east", game_map.get("森林北部"));

    }
}
